package net.chathu.airgw.packets.chat 
{
	import flash.utils.ByteArray;
	import net.chathu.airgw.Config;
	import net.chathu.airgw.model.SessionData;
	import net.chathu.airgw.packets.gw.serverpackets.ISendableIRCPacket;
	import net.chathu.airgw.util.ByteArrayUtil;

	/**
	 * ...
	 * @author ze
	 */
	public class ChatPacket 
	{
		public var sessionData:SessionData;
		public var data:Array;
		
		public function ChatPacket() 
		{
			
		}
		
		/*public function set sessionData(sd:SessionData):void
		{
			_sessionData = sd;
		}*/
		
		/*public function set data(d:Array):void
		{
			_data = d;
		}*/
		
		/*protected function get sessionData():SessionData
		{
			return _sessionData;
		}*/
		
		protected function sendToClient(chatpacket:ISendableIRCPacket):void
		{
			if (sessionData.soul.ircConnection)
			{
				sessionData.soul.ircConnection.sendPacket(chatpacket);
			} else if (Config.DEBUG) {
				trace("IRC kapcsolat nem letezik, uzenet: " + chatpacket.getMessage());
			}
		}
		
		protected function sendToChat(bytearray:ByteArray):void
		{
			sessionData.soul.chatServerConnection.sendPacket(bytearray);
		}
		
		protected function sendParamsToChat(array:Array):void {
			trace("SEND:" + array.join(" "));
			sendToChat(ByteArrayUtil.convertParams(array));
		}
		
		
	
		
		/*protected function get data():Array
		{
			return _data;
		}*/
		
		//OVERRIDE THIS:
		public function execute():void {};
		
	}
}